﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace MyStyle
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }
        /// <summary>   
        /// Field全选   
        /// </summary>   
        private void CheckBox_Click(object sender, RoutedEventArgs e)
        {
            //ObjectDataProvider provider = (ObjectDataProvider)this.FindResource("bndOutputFeilds");
            //List<DocField> fields = provider.Data as List<DocField>;
            //foreach (DocField field in fields)
            //{
            //    field.IsSelected = ((CheckBox)sender).IsChecked.Value;
            //}
        }

        private void chkSomeFiels_Click(object sender, RoutedEventArgs e)
        {
            CheckSelectedFields();
        }

        private void CheckSelectedFields()
        {
        //    ObjectDataProvider provider = (ObjectDataProvider)this.FindResource("bndOutputFeilds");
        //    List<DocField> fields = provider.Data as List<DocField>;
        //    int checkedCount = fields.Where(c => c.IsSelected).Count();
        //    if (checkedCount == 0)
        //    {
        //        chkFieldsAll.IsChecked = false;
        //    }
        //    else if (checkedCount == fields.Count)
        //    {
        //        chkFieldsAll.IsChecked = true;
        //    }
        //    else
        //    {
        //        chkFieldsAll.IsChecked = null;
        //    }
        }   
    }
}
